import { gsap } from "gsap";
import eventBus from "@/js/eventBus";

class ScaleBox {
  constructor() {
    this.current = '';
  }

  setScale(obj) {
    if (!this.current) {
      gsap.to(obj.position, { x: obj.position.x + 0.3, duration: 0.5 });
      this.current = obj;
    } else {
      if (obj.uuid !== this.current.uuid) {
        console.log("移动到新位置");
        gsap.to(obj.position, { x: obj.position.x + 0.3, duration: 0.5 });
        gsap.to(this.current.position, { x: this.current.position.x - 0.3, duration: 0.5 });
        this.current = obj;
      } else {
        console.log("复位");
		eventBus.emit('fuweixtmenuBnt');
        gsap.to(this.current.position, { x: obj.position.x - 0.3, duration: 0.5 });
        this.current = '';
      }
    }
  }
}

export default new ScaleBox();
